package com.caishi.lkx.user.mapper.re;

import com.caishi.lkx.user.model.re.SysGroupLocationReModel;
import com.zzw.common.entity.IBSMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
* @Param:  
* @return 
* @Author: huangpeng
* @Date: 2022/1/6 15:07
* @Description: 
*/
public interface SysGroupLocationReMapper extends IBSMapper<SysGroupLocationReModel, Long> {

    @Select("SELECT s.*, (st_distance (point (longitude, latitude),point(#{longitude},#{latitude}) ) / 0.0111) AS distance FROM sys_group_location_re  s WHERE s.group_id is not null HAVING distance<#{distance}  ORDER BY distance limit 1")
    SysGroupLocationReModel getGroupByLocation(@Param("longitude") BigDecimal longitude, @Param("latitude")BigDecimal latitude, @Param("distance")Integer distance);
}
